<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/4/3
  Time: 18:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="cn.mldn.lzs.factory.*" %>
<%@ page import="cn.mldn.lzs.vo.*" %>
<%@ page import="java.util.*" %>

<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    try {
     String keyWord = request.getParameter("kw");
     if (keyWord == null){
         keyWord = "";
     }
     List<Emp> all = DAOFactory.getEmpDAOInstance().findAll(keyWord);
     Iterator<Emp> iter = all.iterator();
     %>
<form action="emp_list.jsp" method="post">
    请输入查询关键字：<input type="text" name="kw" >
    <input type="submit" value="查询">
</form>
<table border="1" width="80%">
        <td>雇员编号</td>
        <td>雇员姓名</td>
        <td>雇员工作</td>
        <td>雇员工资</td>
        <td>雇佣日期</td>
    </tr>
     <%
     while (iter.hasNext()){
         Emp emp = iter.next();
         %>
           <tr>
               <td><%= emp.getEmpno() %></td>
               <td><%= emp.getEname() %></td>
               <td><%= emp.getJob() %></td>
               <td><%= emp.getSal() %></td>
               <td><%= emp.getHiredate() %></td>
           </tr>
         <%
     }
     %>
</table>
     <%
    }catch (Exception e){
        e.printStackTrace();
    }

%>


</body>
</html>
